﻿/*-----------------------------------------------------------------------
 * <copyright file="OPEntryScoreQueryPage.xaml.cs" company="O-RID">
 *     Copyright (c)2010 O-RID Co.,Ltd.
 * </copyright>
 * <author>Zhang jun</author>
 * <summary>
 *            OP成绩查询页
 *
 *          作成日：05/21/2010
 * </summary>
 *----------------------------------------------------------------------- 
 */
namespace Orid.Management.Statistics.OperatorUnitMangement.ScoreRelated.OPEntryScoreQuery
{
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Navigation;
    using Orid.Management.Statistics.OperatorUnitMangement.Common.SearchCtrl;

    /// <summary>
    ///  OP成绩查询页
    ///  OPEntryScoreQueryPage
    /// </summary>
    public partial class OPEntryScoreQueryPage : Page
    {
        bool isExpanded = false;

        /// <summary>
        /// 构造函数
        /// OPEntryScoreQueryPage
        /// </summary>
        public OPEntryScoreQueryPage()
        {
            InitializeComponent();
        }
     
        /// <summary>
        /// 当用户导航到此页面时执行。
        /// OnNavigatedTo
        /// </summary>
        /// <param name="e">e type of NavigationEventArgs</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            SelAnyContainer selallcontainer = new SelAnyContainer();

            OPEntryScoreQueryControl datagridcontrl = new OPEntryScoreQueryControl(selallcontainer);

            this.bOPEntryScoreQuery.Child = selallcontainer;

            this.bOPEntryScoreContent.Child = datagridcontrl;

            selallcontainer.accoridon.SelectedItemsChanged -= new System.Collections.Specialized.NotifyCollectionChangedEventHandler(accoridon_SelectedItemsChanged);
            selallcontainer.accoridon.SelectedItemsChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(accoridon_SelectedItemsChanged);
            IsExpanded();
        }

        //07/12/2010
        /// <summary>
        /// accoridon 选择ITME事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void accoridon_SelectedItemsChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            IsExpanded();
        }

        /// <summary>
        /// 判断 accoridon 收缩或展开时，DATAGRID的位置
        /// </summary>
        void IsExpanded()
        {
            if (isExpanded == true)
            {
                this.accoridonRow.Height = new GridLength(105);
                this.griddataRow.Height = new GridLength(10, System.Windows.GridUnitType.Star);//占有剩余空间
            }
            else
            {
                this.accoridonRow.Height = new GridLength(25);
                this.griddataRow.Height = new GridLength(10, System.Windows.GridUnitType.Star);
            }

            this.isExpanded = !this.isExpanded;
        }
 
    }
}
